import React, { Component } from 'react';
import { Form, Modal } from 'antd';
const FormItem = Form.Item;
var networkstatus = {
  1000: '创建中',
  1010: '创建成功',
  1020: '创建失败',
  2000: '启动中',
  2010: '启动成功',
  2020: '启动失败',
  3000: '停止中',
  3010: '已停止',
  2030: '启动失败',
  3020: '停止失败'
};
class detail extends Component {
  constructor() {
    super();
    this.state = {
    };
  }
  joinnetwork = () => {
    var { inviteshowModal, detaildata } = this.props;
    inviteshowModal(detaildata);
  }
  render() {
    const { visible, onCancel, form, stop, start, detaildata } = this.props;
    var detaildatan = detaildata ? detaildata : {};
    return (
      <Modal
        className="detailclose"
        visible={visible}
        title={this.props.title}
        // okText="启动"
        // cancelText="停止"
        onCancel={onCancel}
        footer={null}
      >
        {/* <Button type="primary" onClick={this.joinnetwork} >邀请组织加入该网络</Button> */}
        <Form>
          <FormItem
            label="网络中文全称"
            labelCol={{ span: 8 }}
            wrapperCol={{ span: 15 }}
          >
            <span>{detaildatan.nickname}</span>
          </FormItem>
          <FormItem
            label="网络英文全称"
            labelCol={{ span: 8 }}
            wrapperCol={{ span: 15 }}
          >
            <span>{detaildatan.networkName}</span>
          </FormItem>
          <FormItem
            label="Peer节点数量"
            labelCol={{ span: 8 }}
            wrapperCol={{ span: 15 }}
          >
            <span>{detaildatan.peerNum}</span>
          </FormItem>

          <FormItem
            label="Orderer节点数量"
            labelCol={{ span: 8 }}
            wrapperCol={{ span: 15 }}
          >
            <span>{detaildatan.ordererNum}</span>
          </FormItem>
          <FormItem
            label="状态"
            labelCol={{ span: 8 }}
            wrapperCol={{ span: 15 }}
          >
            <span>{networkstatus[detaildatan.networkStatus]}</span>
          </FormItem>
          <FormItem
            label="备注"
            labelCol={{ span: 8 }}
            wrapperCol={{ span: 13 }}
          >
            <span>{detaildatan.remark}</span>
          </FormItem>
        </Form>
        {/* <footer className="detailfooter">
          <Button className="startdetail" disabled={networkstatus[detaildatan.networkStatus] == '启动成功' ? 'disabled' : ''} onClick={start.bind(this, detaildatan.networkName, networkstatus[detaildatan.networkStatus])} >开启</Button>
          <Button className="stopdatail" onClick={stop.bind(this, detaildatan.networkName, networkstatus[detaildatan.networkStatus])} >停止</Button>
        </footer> */}
      </Modal>
    );
  }
}
const Detail = Form.create()(detail);
export default Detail;
